<?php
class Xdate{
    public static function BetweenTwoDate ($day1, $day2) {
        $second1 = strtotime($day1);   
        $second2 = strtotime($day2);        
        return floor(($second2 - $second1) / 86400); 
    } 
    public static function _xxfDateToChinese ($date,$type=1) {
        if($type==1){
            return substr($date, 0,4)."年".substr($date, 5,2)."月".substr($date, 8,2)."日";
        }
    }
    public static function _xxfBirToAge($birthday) {
        $iage = 0;
        if (!empty($birthday)) {
            $year = date('Y',strtotime($birthday));
            $month = date('m',strtotime($birthday));
            $day = date('d',strtotime($birthday));
    
            $now_year = date('Y');
            $now_month = date('m');
            $now_day = date('d');
    
            if ($now_year > $year) {
                $iage = $now_year - $year - 1;
                if ($now_month > $month) {
                    $iage++;
                } else if ($now_month == $month) {
                    if ($now_day >= $day) {
                        $iage++;
                    }
                }
            }
        }
        return $iage;
    }
}